home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Programming / tek / msg / ackmsg.c next >
C/C++ Source or Header  |  2001-05-12  |  596b  |  40 lines

  1.  
  2. #include "tek/msg.h"
  3. #include "tek/kn/exec.h"
  4.  
  5. /* 
  6. **    TEKlib
  7. **    (C) 2001 TEK neoscientists
  8. **    all rights reserved.
  9. **
  10. **    TVOID TAckMsg(TAPTR msg)
  11. **
  12. **    acknowledge a message to sender.
  13. **
  14. */
  15.  
  16. TVOID TAckMsg(TAPTR mem)
  17. {
  18.     if (mem)
  19.     {
  20.         TMSG *msg = ((TMSG *) mem) - 1;
  21.         TPORT *replyport = msg->replyport;
  22.  
  23.         if (replyport)
  24.         {
  25.             msg->status = TMSG_STATUS_ACKD | TMSG_STATUS_PENDING;
  26.  
  27.             kn_lock(&replyport->lock);
  28.  
  29.             TAddTail(&replyport->msglist, (TNODE *) msg);
  30.             TSignal(replyport->sigtask, replyport->signal);
  31.  
  32.             kn_unlock(&replyport->lock);
  33.         }
  34.         else
  35.         {
  36.             TMMUFreeHandle(msg);
  37.         }
  38.     }
  39. }
  40.